package com.idelan.commonMessage.constant;

/**
 * Created with IDEA
 * User gyli
 * date 2018/5/31
 */
public class RestApi {
    private Integer errCode;
    private Object data;
    private String message;

    public Integer getErrCode() {
        return errCode;
    }

    public void setErrCode(Integer errCode) {
        this.errCode = errCode;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public static RestApi getSuccessApi(Object data){
        RestApi restApi = new RestApi();
        restApi.setErrCode(ResponseCode.RSP_SUCCESS);
        restApi.setData(data);
        restApi.setMessage(ResponseMessage.RSP_SUCCESS);
        return restApi;
    }

    public static RestApi getErrorApi(int errCode, String message){
        RestApi restApi = new RestApi();
        restApi.setErrCode(errCode);
        restApi.setData("");
        restApi.setMessage(message);
        return restApi;
    }
}
